/**
 * 56通道版本3d模型
 */
 let { material, material1, materialStaion } = initMaterial();
 let { meshGroupList,geometryModel, groupModel, cylinderMesh, groupTempDot } = initModel();
 let indexs = 0; //测温点序号
 let passagewayTemp = 0; //测温点数
 //初始化材质
 function initMaterial() {
     //默认材质
     material = new THREE.MeshBasicMaterial({
         color: 0x2bff2b,
         // opacity: 0.8,
         transparent: true
     });
     material1 = new THREE.MeshBasicMaterial({
         color: 0x03d7db,
         // opacity: 0.8,
         transparent: true
     });
     //电池仓材质
     materialStaion = new THREE.MeshBasicMaterial({
         color: 0x03d7db,
         opacity: 0.8,
         transparent: true
     });
     return { material, material1, materialStaion };
 }
 
 //初始化模型
 function initModel() {
     geometryModel = new THREE.Geometry();
     //通道模型组添加到场景
     groupModel = new THREE.Group();
     var cylinderGeometry = new THREE.CylinderGeometry(5, 5, 20, 32, 3);
     cylinderMesh = new THREE.Mesh(cylinderGeometry, material);
     //测温点模型组添加到场景
     groupTempDot = new THREE.Group();
     return { geometryModel, groupModel, cylinderMesh, groupTempDot, material, material1 }
 }
 
 /**
  * 创建56通道的换电站模型
  * @param {*} scene 
  */
 export function create56Aisle(scene) {
     let meshGroupList = createFrame()
     scene.add(meshGroupList);
     createPassagewayTransverse();
     createPassagewayVertical();
     createBattery();
     createChest();
     let grid = createFloorLine()
     scene.add(groupModel);
     scene.add(groupTempDot);
     scene.add(grid)
     return [groupModel, groupTempDot,meshGroupList, geometryModel];
 }
 
 //换电站外框架
 function createFrame() {
     var mesh2 = new THREE.Mesh(
         new THREE.CubeGeometry(10, 500, 10, 1, 1),
         material1
     );
     var mesh3 = new THREE.Mesh(
         new THREE.CubeGeometry(10, 800, 10, 1, 1),
         material1
     );
     var mesh4 = new THREE.Mesh(
         new THREE.CubeGeometry(10, 1800, 10, 1, 1),
         material1
     );
 
     for (var a = 0; a < 2; a++) {
         for (var b = 0; b < 2; b++) {
             var box1 = mesh2.clone();
             box1.position.set(a * 950 - 900, 250, b * 800 - 400);
             box1.updateMatrix();
             geometryModel.merge(box1.geometry, box1.matrix);
 
             var box2 = mesh2.clone();
             box2.position.set(a * 400 + 500, 250, b * 800 - 400);
             box2.updateMatrix();
             geometryModel.merge(box2.geometry, box2.matrix);
 
             var box3 = mesh3.clone();
             box3.position.set(a * 950 - 900, b * 500, 0);
             box3.rotateX((90 * Math.PI) / 180);
             box3.updateMatrix();
             geometryModel.merge(box3.geometry, box3.matrix);
 
             var box4 = mesh4.clone();
             box4.position.set(0, a * 500, b * 800 - 400);
             box4.rotateZ((90 * Math.PI) / 180);
             box4.updateMatrix();
             geometryModel.merge(box4.geometry, box4.matrix);
 
             var box5 = mesh3.clone();
             box5.position.set(a * 400 + 500, b * 500, 0);
             box5.rotateX((90 * Math.PI) / 180);
             box5.updateMatrix();
             geometryModel.merge(box5.geometry, box5.matrix);
         }
     }
 
     // C室桌子
     for (let c = 0; c < 2; c++) {
         for (let d = 0; d < 2; d++) {
             var mesh = new THREE.Mesh(
                 new THREE.CubeGeometry(5, 120, 5, 1, 1),
                 material1
             );
             mesh.position.set(c * 300 + 550, 50, d * 120 - 350);
             mesh.updateMatrix();
             geometryModel.merge(mesh.geometry, mesh.matrix);
         }
     }
     var mesh5 = new THREE.Mesh(
         new THREE.CubeGeometry(310, 150, 5, 1, 1),
         material1
     );
     mesh5.position.set(700, 110, -300);
     mesh5.rotateX((90 * Math.PI) / 180);
     mesh5.updateMatrix();
     geometryModel.merge(mesh5.geometry, mesh5.matrix);
 
     //从机服务器↓
     var mesh8 = new THREE.Mesh(
         new THREE.CubeGeometry(50, 20, 50, 1, 1),
         material1
     );
     var position = [
         [250, -250],
         [-400, -250],
         [-850, -20],
         [-400, 250],
     ];
     for (let e = 0; e < 4; e++) {
         let box6 = mesh8.clone();
         box6.position.set(position[e][0], 10, position[e][1]);
         box6.updateMatrix();
         geometryModel.merge(box6.geometry, box6.matrix);
     }
 
     // 充电机柜↓
     var mesh9 = new THREE.Mesh(
         new THREE.CubeGeometry(4, 500, 10, 1, 1),
         material1
     );
     var mesh10 = new THREE.Mesh(
         new THREE.CubeGeometry(4, 4, 250, 1, 1),
         material1
     );
     var mesh11 = new THREE.Mesh(
         new THREE.CubeGeometry(200, 4, 4, 1, 1),
         material1
     );
     for (let f = 0; f < 2; f++) {
         for (let g = 0; g < 2; g++) {
             // A室
             let box7 = mesh9.clone();
             box7.position.set(-700, 250, f * 550 - 400 + g * 250);
             box7.updateMatrix();
             geometryModel.merge(box7.geometry, box2.matrix);
             let box8 = mesh10.clone();
             box8.position.set(-700, f * 500, g * 540 - 270);
             box8.updateMatrix();
             geometryModel.merge(box8.geometry, box8.matrix);
             let box9 = mesh11.clone();
             box9.position.set(-800, f * 500, g * 300 - 150);
             box9.updateMatrix();
             geometryModel.merge(box9.geometry, box9.matrix);
 
             // //B室
             var box10 = mesh9.clone();
             box10.position.set(f * 200 + 50, 250, g * 250 + 150);
             box10.updateMatrix();
             geometryModel.merge(box10.geometry, box10.matrix);
 
             //C室
             var box11 = mesh9.clone();
             box11.position.set(f * 200 + 700, 250, g * 250 + 150);
             box11.updateMatrix();
             geometryModel.merge(box11.geometry, box11.matrix);
         }
 
         //C室
         var box15 = mesh10.clone();
         box15.position.set(700, f * 500, 270);
         box15.updateMatrix();
         geometryModel.merge(box15.geometry, box15.matrix);
         var box16 = mesh11.clone();
         box16.position.set(800, f * 500, 150);
         box16.updateMatrix();
         geometryModel.merge(box16.geometry, box16.matrix);
     }
     // 充电机柜↑
     let meshGroupList = new THREE.Mesh(geometryModel,material1);
     return meshGroupList;
 }
 
 function createFloorLine() {
     //添加地板割线
     var grid = new THREE.GridHelper(2000, 40, "#1082FA", "#1082FA");
     grid.material.opacity = 0.2;
     grid.material.transparent = true;
     return grid;
 }
 
 //底部通道
 function createPassagewayTransverse() {
     var mech2 = new THREE.Mesh(
         new THREE.CubeGeometry(650, 5, 5, 32),
         material1
     );
     for (var h = 0; h < 2; h++) {
         for (var i = 0; i < 2; i++) {
             var box2 = mech2.clone();
             box2.position.set(-350, 10, h * 160 + (i * 510 - 330));
             box2.name = "channel_" + (h * 1 + i * 2 + 53);
             groupModel.add(box2);
         }
     }
 
     var curve = new THREE.CatmullRomCurve3(
         [
             new THREE.Vector3(80, 0, 140),
             new THREE.Vector3(110, 0, -240),
             new THREE.Vector3(180, 0, -290),
             new THREE.Vector3(480, 0, -300),
         ],
         false
     );
     var curve2 = new THREE.CatmullRomCurve3(
         [
             new THREE.Vector3(140, 0, 140),
             new THREE.Vector3(160, 0, -180),
             new THREE.Vector3(300, 0, -200),
             new THREE.Vector3(480, 0, -200),
         ],
         false
     );
 
     // var tubeGeometry = new THREE.TubeGeometry(curve, 100, 2, 50, false);
 
     var tubeGeometry2 = new THREE.TubeGeometry(curve, 100, 3, 50, false);
     var tube2 = new THREE.Mesh(tubeGeometry2, material1); //材质可替换成流动materialww
     tube2.name = "channel_51";
     groupModel.add(tube2);
 
     var tubeGeometry3 = new THREE.TubeGeometry(curve2, 100, 3, 50, false);
     var tube3 = new THREE.Mesh(tubeGeometry3, material1); //材质可替换成流动materialww
     tube3.name = "channel_52";
     groupModel.add(tube3);
 }
 
 //竖型通道
 function createPassagewayVertical() {
 
     var geometry = new THREE.CubeGeometry(4, 500, 4, 32);
     var cylinder2 = new THREE.Mesh(geometry, material1);
 
     //线圈2↓
     var TorusGeometry = new THREE.TorusGeometry(20, 2, 30, 20, Math.PI * 2);
     var coilLine = new THREE.Mesh(TorusGeometry, material1);
     //线圈2↑
 
     //A室竖型通道
     //35-36通道
     for (var j = 0; j < 2; j++) {
         var box17 = cylinder2.clone();
         box17.position.set(-810, 250, -(j * 250) - 150);
         box17.name = "channel_" + (j + 35);
         groupModel.add(box17);
     }
     //43-44通道
     for (let k1 = 0; k1 < 2; k1++) {
         let box18 = cylinder2.clone();
         box18.position.set(-810, 250, k1 * 250 + 150);
         box18.name = "channel_" + (k1 + 43);
         groupModel.add(box18);
     }
 
     //B室竖型通道
     for (let l = 0; l < 2; l++) {
         let box19 = cylinder2.clone();
         box19.position.set(-(l * 200) + 250, 250, 300);
         box19.name = "channel_" + (l * 1 + 31);
         groupModel.add(box19);
     }
     //线圈通道A室
     for (var k = 0; k < 2; k++) {
         var num = 0,
             num2 = k * 8 + 37;
         for (let i = 0; i < 12; i++) {
             if (num == 4) {
                 num = 0;
                 num2++;
             }
             for (let j1 = 0; j1 < 2; j1++) {
                 var box2_2 = coilLine.clone();
                 box2_2.rotateX((90 * Math.PI) / 180);
                 box2_2.position.set(-850, i * 35 + 40, j1 * 100 - 330 + k * 550);
                 box2_2.name = "channel_" + num2 + "_" + num;
                 groupModel.add(box2_2);
                 num++;
             }
         }
     }
     //线圈通道B室
     var num1 = 0;
     for (let i1 = 0; i1 < 4; i1++) {
         if (i1 == 2) {
             num1 = 0;
         }
         for (let j2 = 0; j2 < 2; j2++) {
             var box2_3 = coilLine.clone();
             box2_3.rotateX((90 * Math.PI) / 180);
             box2_3.position.set(j2 * 70 + 120, i1 * 50 + 240, 300);
             box2_3.name = "channel_" + (i1 < 2 ? 33 : 34) + "_" + num1;
             groupModel.add(box2_3);
             num1++;
         }
     }
 }
 
 //电池仓
 function createBattery() {
     var tempSpotGeometry = new THREE.CubeGeometry(180, 10, 150, 1, 1);
     var tempSpotGround = new THREE.Mesh(
         tempSpotGeometry,
         materialStaion
     );
 
     // 平面 (1-4通道) ---B室电池点1
     for (var n = 0; n < 4; n++) {
         var sphereX = 280,
             sphereY = n * 120 + 100,
             sphereZ = -180;
         var box2 = tempSpotGround.clone();
         box2.position.set(sphereX, sphereY, sphereZ);
         box2.name = "channel_" + (n + 1);
         groupModel.add(box2);
         passagewayTemp += 1;
         Sphere(sphereX, sphereY + 5, sphereZ, passagewayTemp);
     }
 
     // 平面(5-16通道)---
     for (let i2 = 0; i2 < 3; i2++) {
         for (let j2 = 0; j2 < 4; j2++) {
             var sphereX1 = -(i2 * 220) - 130;
             var sphereY1 = j2 * 120 + 100;
             var sphereZ1 = -250;
             var box2_4 = tempSpotGround.clone();
             box2_4.position.set(sphereX1, sphereY1, sphereZ1);
             box2_4.name = "channel_" + (i2 * 4 + j2 * 1 + 5);
             groupModel.add(box2_4);
             passagewayTemp += 1;
             Sphere(sphereX1, sphereY1 + 5, sphereZ1, passagewayTemp);
         }
     }
 
     // 平面(17-28通道)---A室电池点2
     for (let i = 0; i < 3; i++) {
         for (let j = 0; j < 4; j++) {
             var sphereX3 = -(i * 220) - 130;
             var sphereY3 = j * 120 + 100;
             var sphereZ3 = 300;
             var box2_5 = tempSpotGround.clone();
             box2_5.position.set(sphereX3, sphereY3, sphereZ3);
             box2_5.name = "channel_" + (i * 4 + j * 1 + 17);
             groupModel.add(box2_5);
             passagewayTemp += 1;
             Sphere(sphereX3, sphereY3 + 5, sphereZ3, passagewayTemp);
         }
     }
 
     // 平面 (29-30通道) ---B室电池点2
     for (let n = 0; n < 2; n++) {
         var sphereX2 = 380,
             sphereY2 = n * 120 + 300,
             sphereZ2 = 320;
         var box2_6 = tempSpotGround.clone();
         box2_6.position.set(sphereX2, sphereY2, sphereZ2);
         box2_6.name = "channel_" + (n + 29);
         groupModel.add(box2_6);
         passagewayTemp += 1;
         Sphere(sphereX2, sphereY2 + 5, sphereZ2, passagewayTemp);
     }
 }
 
 //充电柜温度点,线槽温度点
 function createChest() {
     // 竖型通道B室 (31-32通道)
     for (var i1 = 0; i1 < 2; i1++) {
         passagewayTemp += 1;
         for (var j1 = 0; j1 < 8; j1++) {
             var box3 = cylinderMesh.clone();
             box3.position.set(-(i1 * 200) + 250, j1 * 50 + 80, 300);
             box3.name = "passageway_" + passagewayTemp+"_"+(j1 + 1);
             indexs++;
             box3.passageway = passagewayTemp;
             box3.index = j1 + 1;
             box3.tempNum = 0;
             box3.coordinate = -(i1 * 150) + 70 + "," + (j1 * 50 + 50) + "," + 300;
             groupTempDot.add(box3);
         }
     }
     // 线圈B室 (33-34通道)
     for (let i = 0; i < 4; i++) {
         if (i % 2 == 0) passagewayTemp += 1;
         for (let j = 0; j < 2; j++) {
             for (var k = 0; k < 2; k++) {
                 var box3_1 = cylinderMesh.clone();
                 var x = 0,
                     y = 0,
                     z = 0;
                 if (i % 2 && j % 2) {
                     x = j * 70 - 40;
                     z = -(k * 45) + 370;
                 } else if (i % 2 && j % 2 != 1) {
                     x = j * 70 - 40;
                     z = k * 45 + 325;
                 } else if (i % 2 != 1 && j % 2) {
                     x = -(j * 70) + 30;
                     z = -(k * 45) + 370;
                 } else if (i % 2 != 1 && j % 2 != 1) {
                     x = j * 70 + 30;
                     z = k * 45 + 325;
                 }
                 y = -(i * 50) + (i < 2 ? 290 : 490);
                 box3_1.position.set(x + 160, y, z - 50);
                 box3_1.rotateZ((90 * Math.PI) / 180);
                 box3_1.coordinate =
                     k * 70 - 40 + "," + (i * 40 + 240) + "," + (j * 45 + 325);
                 indexs++;
                 box3_1.index =
                     i < 2
                         ? i * 4 + j * 2 + (k * 1 + 1)
                         : i * 4 + j * 2 + (k * 1 + 1) - 8; //indexs += 1;
                 box3_1.name = "passageway_" + passagewayTemp + "_" + box3_1.index;
                 box3_1.passageway = passagewayTemp;
                 box3_1.tempNum = 0;
                 groupTempDot.add(box3_1);
             }
         }
     }
     //  竖型通道A室1 (35-36通道)
     for (let i2 = 0; i2 < 2; i2++) {
         passagewayTemp += 1;
         for (let j2 = 0; j2 < 8; j2++) {
             var box20 = cylinderMesh.clone();
             box20.position.set(-810, j2 * 50 + 100, -(i2 * 250) - 150);
             box20.coordinate =
                 -810 + "," + (j2 * 40 + 40) + "," + (i2 * 150 - 100);
             indexs++;
             box20.index = j2 + 1; //indexs += 1;
             box20.passageway = passagewayTemp;
             box20.tempNum = 0;
             box20.name = "passageway_" + passagewayTemp + "_" + box20.index;
             groupTempDot.add(box20);
         }
     }
     var number = 0;
     // 线圈A室1 (37-42通道)
     for (var m = 0; m < 12; m++) {
         if (m % 2 == 0) {
             passagewayTemp += 1;
             number = 0;
         }
         for (var n = 0; n < 2; n++) {
             number++;
             var box21 = cylinderMesh.clone();
             box21.position.set(-850, m * 35 + 40, n * 45 - 353);
             box21.rotateZ((90 * Math.PI) / 180);
             box21.coordinate = -860 + "," + (m * 25 + 50) + "," + (n * 45 - 83);
             indexs++;
             box21.index = number;
             box21.passageway = passagewayTemp;
             box21.name = "passageway_" + passagewayTemp + "_" + box21.index;
             box21.tempNum = 0;
             groupTempDot.add(box21);
         }
         for (var o = 0; o < 2; o++) {
             number++;
             var box22 = cylinderMesh.clone();
             box22.position.set(-850, m * 35 + 40, o * 45 - 253);
             box22.rotateZ((90 * Math.PI) / 180);
             box22.coordinate = -860 + "," + (m * 25 + 50) + "," + (o * 45 - 13);
             indexs++;
             box22.index = number;
             box22.passageway = passagewayTemp;
             box22.name = "passageway_" + passagewayTemp + "_" + box22.index;
             box22.tempNum = 0;
             groupTempDot.add(box22);
         }
     }
 
     //  竖型通道A室2 (43-44通道)
     for (var p = 0; p < 2; p++) {
         passagewayTemp += 1;
         for (var q = 0; q < 8; q++) {
             var box23 = cylinderMesh.clone();
             box23.position.set(-810, q * 50 + 100, p * 250 + 150);
             box23.coordinate = -810 + "," + (q * 40 + 40) + "," + (p * 150 + 250);
             indexs++;
             box23.index = q + 1;
             box23.passageway = passagewayTemp;
             box23.name = "passageway_" + box23.passageway + "_" + box23.index;
             box23.tempNum = 0;
             groupTempDot.add(box23);
         }
     }
     number = 0;
     // 线圈A室2 (45-50通道)
     for (var r = 0; r < 12; r++) {
         if (r % 2 == 0) {
             passagewayTemp += 1;
             number = 0;
         }
         for (var s = 0; s < 2; s++) {
             number++;
             var box24 = cylinderMesh.clone();
             box24.position.set(-850, r * 35 + 40, s * 45 + 198);
             box24.rotateZ((90 * Math.PI) / 180);
             box24.coordinate = -860 + "," + (r * 25 + 50) + "," + (s * 45 + 265);
             indexs++;
             box24.index = number;
             box24.passageway = passagewayTemp;
             box24.name = "passageway_" + box24.passageway + "_" + box24.index;
             box24.tempNum = 0;
             groupTempDot.add(box24);
         }
         for (var s1 = 0; s1 < 2; s1++) {
             number++;
             var box25 = cylinderMesh.clone();
             box25.position.set(-850, r * 35 + 40, s1 * 45 + 298);
             box25.rotateZ((90 * Math.PI) / 180);
             box25.coordinate = -860 + "," + (r * 25 + 50) + "," + (s1 * 45 + 335);
             indexs++;
             box25.index = number;
             box25.passageway = passagewayTemp;
             box25.name = "passageway_" + box25.passageway + "_" + box25.index;
             box25.tempNum = 0;
             groupTempDot.add(box25);
         }
     }
 
     // 底部通道B室 (51-52通道)
     for (var u1 = 0; u1 < 2; u1++) {
         passagewayTemp += 1;
         for (var u2 = 0; u2 < 9; u2++) {
             var box26 = cylinderMesh.clone();
             box26.position.set(u1 * 50 + 85, 0, -(u2 * 30) + 100);
             box26.rotateX((90 * Math.PI) / 180);
             box26.coordinate = u1 * 50 - 50 + "," + 10 + "," + (-(u2 * 30) + 320);
             indexs++;
             box26.index = u2 + 1;
             box26.passageway = passagewayTemp;
             box26.tempNum = 0;
             box26.name = "passageway_" + box26.passageway + "_" + box26.index;
             groupTempDot.add(box26);
         }
         for (var u3 = 0; u3 < 9; u3++) {
             var box27 = cylinderMesh.clone();
             box27.position.set(u3 * 35 + 180, 10, u1 * 100 - 300);
             box27.rotateZ((90 * Math.PI) / 180);
             box27.coordinate = u3 * 35 + 20 + "," + 10 + "," + (u1 * 80 + 10);
             indexs++;
             box27.index = u3 + 10;
             box27.passageway = passagewayTemp;
             box27.tempNum = 0;
             box27.name = "passageway_" + box27.passageway + "_" + box27.index;
             groupTempDot.add(box27);
         }
     }
 
     // 底部通道A室1 (53-54通道)
     for (var v1 = 0; v1 < 2; v1++) {
         passagewayTemp += 1;
         for (var v = 0; v < 18; v++) {
             var box31 = cylinderMesh.clone();
             box31.position.set(v * 35 - 650, 10, v1 * 160 - 330);
             box31.rotateZ((90 * Math.PI) / 180);
             box31.coordinate = v * 60 - 730 + "," + 10 + "," + (v1 * 100 - 70);
             indexs++;
             box31.index = v + 1;
             box31.passageway = passagewayTemp;
             box31.tempNum = 0;
             box31.name = "passageway_" + box31.passageway + "_" + box31.index;
             groupTempDot.add(box31);
         }
     }
 
     // 底部通道A室2 (55-56通道)
     for (var w = 0; w < 2; w++) {
         passagewayTemp += 1;
         for (var u = 0; u < 18; u++) {
             var box30 = cylinderMesh.clone();
             box30.position.set(u * 35 - 650, 10, w * 160 + 180);
             box30.rotateZ((90 * Math.PI) / 180);
             box30.coordinate = u * 60 - 730 + "," + 10 + "," + (w * 100 + 270);
             indexs++;
             box30.index = u + 1; //indexs += 1;
             box30.passageway = passagewayTemp;
             box30.tempNum = 0;
             box30.name = "passageway_" + box30.passageway + "_" + box30.index;
             groupTempDot.add(box30);
         }
     }
 }
 
 //绘制通道上的测温点
 function Sphere(sphereX, sphereY, sphereZ, passageway) {
     var geometrySemicircle = new THREE.SphereGeometry(
         10,
         10,
         10,
         0,
         Math.PI * 2,
         0,
         Math.PI / 2
     );
     // var faceIndices = ['a', 'b', 'c'];
     for (var i = 0; i < geometrySemicircle.faces.length; i++) {
         var face = geometrySemicircle.faces[i];
         for (var j = 0; j < 3; j++) {
             // var vertexIndex = face[faceIndices[j]];
             // var point = geometrySemicircle.vertices[vertexIndex];
             var color = new THREE.Color(0x008000);
             face.vertexColors[j] = color;
         }
     }
     for (let i = 0; i < 4; i++) {
         for (var p = 0; p < 4; p++) {
             var spX = i * 40 + sphereX - 60;
             var spY = sphereY + 5;
             var spZ = 0;
             if (
                 (passageway < 17 && i % 2 != 0) ||
                 (passageway > 16 && i % 2 == 0)
             ) {
                 spZ = p * 40 + sphereZ - 60;
             } else {
                 spZ = -(p * 40) + sphereZ + 60;
             }
             //圆柱体
             var box3 = cylinderMesh.clone();
             box3.position.set(spX, spY, spZ);
             box3.rotateX((90 * Math.PI) / 180);
             indexs++;
             box3.passageway = passageway;
             box3.index = i * 4 + p * 1 + 1;
             box3.name = "passageway_" + box3.passageway + "_" + box3.index;
             box3.tempNum = "-";
             box3.coordinate = spX + "," + spY + "," + spZ;
             groupTempDot.add(box3);
             //圆柱体
         }
     }
 }
 
 export function destroy(scene) {
     // 递归遍历组对象group释放所有后代网格模型绑定几何体占用内存
     groupModel.traverse(function (item) {
         if (item instanceof THREE.Mesh) {
             item.geometry.dispose(); //删除几何体
             item.material.dispose(); //删除材质
         }
     });
     groupTempDot.traverse(function (item) {
         if (item instanceof THREE.Mesh) {
             item.geometry.dispose(); //删除几何体
             item.material.dispose(); //删除材质
         }
     });
     // 删除场景对象scene的子对象group
     scene.remove(groupModel, groupTempDot);
 }